<div>
    <fieldset>
        <legend>Данные пользователя</legend>

        <table class="FormTable">

            <tr><td></td><td class="ErrorMessage" data-field="log"></td></tr>
            <tr>
                <td><label for="type">Тип:</label></td>
                <td><?php echo $this->UserTypes("type_id", false)
                        ->SetAttribute("class", "Text")
                        ->ToHtml(); ?></td>
            </tr>

            <tr style="padding-top: 2em;">
                <td class="AlignRight"><label for="login">Логин:</label></td>
                <td><input class="Text" type="text" id="login"
                    value="<?php echo $this->NewLogin(); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="login"></td></tr>

            <tr>
                <td class="AlignRight"><label for="pass">Пароль:</label></td>
                <td><input class="Text" type="text" id="pass"
                    value="<?php echo $this->NewPass(); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="pass"></td></tr>

            <tr>
                <td class="AlignRight"><label for="fullname">ФИО:</label></td>
                <td><input class="Text" type="text" id="fullname"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="fullname"></td></tr>

            <tr>
                <td><label for="reg_date">Дата регистрации:</label></td>
                <td><input class="Text" type="text" id="reg_date"
                    value="<?php echo date('d.m.Y', time()); ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_date"></td></tr>

            <tr>
                <td><label for="reg_comp">Дата окончания:</label></td>
                <td><input class="Text" type="text" id="reg_comp"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="reg_comp"></td></tr>
        </table>

    </fieldset>

    <div class="ControlPanel">
        <button id="AddUserBtn">Создать</button>
        <button id="CancelBtn">Отмена</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {

        jsun("#AddUserBtn").jsun.event({ onclick: AddUser });
        jsun("#CancelBtn").jsun.event({ onclick: CancelAdd });

        function AddUser() {
            var param = "u=Admin/AddUser" + jsun.page.get_data();

            jsun.json.load(function(p) {
                if (p.STAT == 'OK') {
                    FindUser();
                    jsun.dialog.active.close();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }

        function FindUser() {
            var pref = "UserList";
            jsun.swap[pref].Req = param + jsun.page.get_data();
            jsun.swap[pref].Start();
        }

        function CancelAdd() {
            return jsun.dialog.active.close();
        }

        });
    </script>
</div>